#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <MWait.h>
#include <QPushButton>
#include <QCoreApplication>
#include <QApplication>
#include "waitingspinnerwidget.h"
#include <QFrame>
#include <QHBoxLayout>
#include <QVBoxLayout>


bool checked = true;
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    ui->spinner->setRoundness(50.0);
    ui->spinner->setMinimumTrailOpacity(15.0);
    ui->spinner->setTrailFadePercentage(70.0);
    ui->spinner->setNumberOfLines(16);
    ui->spinner->setLineLength(15);
    ui->spinner->setLineWidth(5);
    ui->spinner->setInnerRadius(30);
    ui->spinner->setRevolutionsPerSecond(1);
    ui->spinner->setColor(QColor(81, 4, 71));
    ui->spinner->setCenterOnParent(false);
    ui->spinner->setDisableParentWhenSpinning(false);
    ui->spinner->start();

    QObject::connect(ui->pushButton, &QPushButton::clicked, [=]()  {
        qInfo() << checked;
        if (checked) {
            ui->spinner->stop();
        } else {
            ui->spinner->start();
        }
        checked = !checked;

    });
}

MainWindow::~MainWindow()
{
    delete ui;
}
